﻿using System;
using System.Collections.Generic;
using System.Data;
using System.Data.SqlClient;
using System.Text;
using Entity;

namespace ServiceCore.Tool.Dapper
{
    public interface IDapper_Helper
    {
        string ReadSqlConnection { get; }
        string WriteSqlConnection { get; }
        string RkSqlConnection { get; }

        ResultListModel<T> GetRKPageList<T>(string MasterSql, string where, string orderby, object serchobj, bool? IsPage, int? start, int? pagesize, string sort = "desc");
        int do_rk47_Execute(string query, object param);
        IEnumerable<T> Get_rk47_List<T>(string query, object param);
        int do_rk_Execute(string query, object param);
        IEnumerable<T> Get_rk_List<T>(string query, object param);
        object GetList(string query, object param);
        int do_Execute(string query, object param);
        IEnumerable<T> GetList<T>(string query, object param);
        IEnumerable<T> GetList<T>(string[] where, object param, string orderby = "", string desc = "");
        IEnumerable<T> GetList<T>(string[] where, object param, int pageindex, int pagesize, string orderby = "", string desc = "");
        T GetModel<T>(string[] where, object param);
        T GetRKModel<T>(string[] where, object param);
        int GetCount<T>(string[] where, object param);
        IEnumerable<T> GetPageList<T>(string[] where, string orderby, bool isdesc, int pageindex, int pagesize, object param, ref int count);
        string AddBySqlStr<T>();
        int Add<T>(T Entity);
        int Add<T>(List<T> EntityList);
        int Update<T>(string[] set, string[] where, object param);
        string UpdateBySqlstr<T>(string[] set, string[] where);
        int Delete<T>(string[] where, object param);
        int StartTran(List<Dapper_Helper.DapperToTransaction_Model> SqlStrList);
        int StartTran(Func<SqlConnection, SqlTransaction, int> Implement, ref string error);
        int StartRKTran(Func<SqlConnection, SqlTransaction, int> Implement, ref string error);
        ResultListModel<T> GetPageList<T>(string MasterSql, string where, string orderby, object serchobj, bool? IsPage, int? page, int? pagesize, string sort = "desc");

    }
}
